# Python数据类型之字典
# 01：创建
dict = {"首都":"北京","特区":"深圳","年份":50}
print(dict)
dict = {"首都":"北京","特区":("深圳","雄安新区")}
print(dict)

# 02：访问
print("-----------访问元素--------------")
dict = {"首都":"北京","特区":"深圳","年份":50}
print(dict["首都"])
# 如果key 不存在，则抛出异常
#print(dict["首都2"])

# 03： 修改元素
print("-----------修改元素--------------")
dict = {"首都":"北京","特区":"深圳","年份":50}
dict["首都"] = "重庆"
print(dict)

# 04 ：删除元素
print("-----------删除元素--------------")
dict = {"首都":"北京","特区":"深圳","年份":50}
del dict["首都"]
print(dict)
# 清空
dict.clear()
print(dict)
# 清空
del dict
print(dict)